package com.jiang.daily.Q729;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/01/02 20:37
 */
class MyCalendar {
    List<int[]> list;
    public MyCalendar() {
        list = new ArrayList<>();
    }

    public boolean book(int startTime, int endTime) {
        for (int i = 0; i < list.size(); i++) {
            int start = list.get(i)[0];
            int end = list.get(i)[1];
            if (!(startTime >= end || endTime <= start)) return false;
        }
        list.add(new int[]{startTime, endTime});
        return true;
    }
}
